/*            Copyright(c) 2006-2008 Dave Sexton           *
 * http://www.codeplex.com/DocProject                      *
 * http://www.codeplex.com/DocProject/Project/License.aspx *
 ***********************************************************/
using System;
using System.Collections.Generic;
using System.Text;

namespace DaveSexton.DocProject
{
	public abstract class BuildProcessComponentInitializer : MarshalByRefObject
	{
		#region Public Properties
		#endregion

		#region Private / Protected
		#endregion

		#region Constructors
		/// <summary>
		/// Constructs a new instance of the <see cref="BuildProcessComponentInitializer" /> class for derived classes.
		/// </summary>
		protected BuildProcessComponentInitializer()
		{
		}
		#endregion

		#region Methods
		internal static BuildProcessComponentInitializer Create(AppDomain domain, Type type)
		{
			if (!type.IsSubclassOf(typeof(BuildProcessComponentInitializer)))
				throw new InvalidOperationException(Resources.Errors.InvalidBPCInitializerType);

			return (BuildProcessComponentInitializer) domain.CreateInstanceAndUnwrap(type.Assembly.FullName, type.FullName);
		}

		[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.LinkDemand,
			Flags = System.Security.Permissions.SecurityPermissionFlag.Infrastructure)]
		public override object InitializeLifetimeService()
		{
			return null;
		}

		public abstract void Initialize(BuildContext context, BuildProcessComponent component);
		#endregion
	}
}
